import 'package:flutter/material.dart';
import 'package:card_swiper/card_swiper.dart';

class SwiperPage1 extends StatefulWidget {
  const SwiperPage1({Key? key}) : super(key: key);

  @override
  _SwiperPage1State createState() => _SwiperPage1State();
}

class _SwiperPage1State extends State<SwiperPage1> {
  List<Map> swiperList=[
    {
      'url':'https://www.itying.com/images/flutter/1.png'
    },
    {
      'url':'https://www.itying.com/images/flutter/2.png'
    },
    {
      'url':'https://www.itying.com/images/flutter/3.png'
    },
    {
      'url':'https://www.itying.com/images/flutter/4.png'
    },
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('轮播图'),
      ),
      body:Column(
        children: [
          Container(
            width: double.infinity,
            child:AspectRatio(
                aspectRatio: 16/9,
                child: Swiper(
                  itemBuilder: (BuildContext context,int index){
                    return new Image.network(swiperList[index]['url'],fit: BoxFit.fill,);
                  },
                  itemCount: 4,
                  pagination: new SwiperPagination(),//底部圆圈，分页器
                  control: new SwiperControl(),//左右箭头
                ),
            ),
          ),
          Row(
            children: [
              Text('文本'),
            ],
          )
        ],
      ),
    );
  }
}
